import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'

//二级
export const ROUTER_ERJI: RouteRecordRaw[] = [
  {
    path: '/home',
    meta: {
      title: "首页",
      icon: 'PieChart'
    },
    component: () => import('../views/index/index.vue'),
  },
  {
    path: '/tubiao',
    meta: {
      title: "图表",
      icon: ''
    },
    component: () => import('../views/tubiao/index.vue'),
  },
    {
    path: '/my',
    meta: {
      title: "我的",
      icon: 'Tools'
    },
    children: [
      {
        path: '/my/order',
        meta: {
          title: "订单",
          icon: 'Tickets'
        },
        component: () => import('../views/order/index.vue'),
      },
      {
        path: '/my/list',
        meta: {
          title: "列表",
          icon: 'Memo'
        },
        component: () => import('../views/list/index.vue'),
      },
    ]
  },
]
//一级
const ROUTER: RouteRecordRaw[] = [
  {
    path: '/login',
    meta: {
      title: "登录",
      icon: ''
    },
    component: () => import('../views/login/index.vue'),
  },
  {
    path: '/',
    meta: {
      title: "主页",
      icon: ''
    },
    redirect: "/home",
    component: () => import('../views/home/index.vue'),
    children: ROUTER_ERJI
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: ROUTER,
})

export default router
